{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import sys\n",
    "import pandas as pd \n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import missingno as msno\n",
    "import seaborn as sns\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "%matplotlib inline\n",
    "from scipy.stats import *\n",
    "import math\n",
    "\n",
    "from tools.config import CONFIG"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['/home/wuxiang/data-vol-1/comptetition/mycode/tools/../../dataset/csv_merged_dataset/A1_MERGE.csv']"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path = CONFIG().MERGED_DATASET_PATH\n",
    "targets = [os.path.join(path, i) for i in os.listdir(path)]\n",
    "targets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>模型运行日期</th>\n",
       "      <th>预测时间</th>\n",
       "      <th>地点</th>\n",
       "      <th>T</th>\n",
       "      <th>GROUND_T</th>\n",
       "      <th>PER_WET</th>\n",
       "      <th>WET</th>\n",
       "      <th>WIND</th>\n",
       "      <th>WIND_DIR</th>\n",
       "      <th>...</th>\n",
       "      <th>SO2_</th>\n",
       "      <th>NO2_</th>\n",
       "      <th>PM10_</th>\n",
       "      <th>PM2.5_</th>\n",
       "      <th>O3_</th>\n",
       "      <th>CO_</th>\n",
       "      <th>T_</th>\n",
       "      <th>WET_</th>\n",
       "      <th>WIND_</th>\n",
       "      <th>WIND_DIR_</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2020-07-23 00:00:00</td>\n",
       "      <td>2020-07-23 00:00:00</td>\n",
       "      <td>监测点A1</td>\n",
       "      <td>29.8013</td>\n",
       "      <td>303.969</td>\n",
       "      <td>0.018661</td>\n",
       "      <td>66.4151</td>\n",
       "      <td>4.74343</td>\n",
       "      <td>168.368</td>\n",
       "      <td>...</td>\n",
       "      <td>15.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>0.55</td>\n",
       "      <td>28.3</td>\n",
       "      <td>71.956</td>\n",
       "      <td>2.3</td>\n",
       "      <td>178.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>2020-07-23 00:00:00</td>\n",
       "      <td>2020-07-23 01:00:00</td>\n",
       "      <td>监测点A1</td>\n",
       "      <td>29.6683</td>\n",
       "      <td>303.670</td>\n",
       "      <td>0.018639</td>\n",
       "      <td>66.8868</td>\n",
       "      <td>4.43134</td>\n",
       "      <td>168.069</td>\n",
       "      <td>...</td>\n",
       "      <td>9.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>0.50</td>\n",
       "      <td>28.0</td>\n",
       "      <td>73.352</td>\n",
       "      <td>1.6</td>\n",
       "      <td>182.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>2020-07-23 00:00:00</td>\n",
       "      <td>2020-07-23 02:00:00</td>\n",
       "      <td>监测点A1</td>\n",
       "      <td>29.4979</td>\n",
       "      <td>303.341</td>\n",
       "      <td>0.018906</td>\n",
       "      <td>68.5624</td>\n",
       "      <td>4.77030</td>\n",
       "      <td>167.315</td>\n",
       "      <td>...</td>\n",
       "      <td>9.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>0.50</td>\n",
       "      <td>28.0</td>\n",
       "      <td>73.548</td>\n",
       "      <td>1.7</td>\n",
       "      <td>172.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>2020-07-23 00:00:00</td>\n",
       "      <td>2020-07-23 03:00:00</td>\n",
       "      <td>监测点A1</td>\n",
       "      <td>29.2256</td>\n",
       "      <td>302.991</td>\n",
       "      <td>0.019813</td>\n",
       "      <td>73.0726</td>\n",
       "      <td>3.99873</td>\n",
       "      <td>182.342</td>\n",
       "      <td>...</td>\n",
       "      <td>9.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>0.50</td>\n",
       "      <td>27.8</td>\n",
       "      <td>75.101</td>\n",
       "      <td>1.3</td>\n",
       "      <td>159.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>2020-07-23 00:00:00</td>\n",
       "      <td>2020-07-23 04:00:00</td>\n",
       "      <td>监测点A1</td>\n",
       "      <td>28.6577</td>\n",
       "      <td>302.598</td>\n",
       "      <td>0.020176</td>\n",
       "      <td>77.1057</td>\n",
       "      <td>2.93413</td>\n",
       "      <td>197.937</td>\n",
       "      <td>...</td>\n",
       "      <td>10.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>0.45</td>\n",
       "      <td>27.1</td>\n",
       "      <td>78.152</td>\n",
       "      <td>2.1</td>\n",
       "      <td>170.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 37 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   Unnamed: 0               模型运行日期                 预测时间     地点        T  \\\n",
       "0           0  2020-07-23 00:00:00  2020-07-23 00:00:00  监测点A1  29.8013   \n",
       "1           1  2020-07-23 00:00:00  2020-07-23 01:00:00  监测点A1  29.6683   \n",
       "2           2  2020-07-23 00:00:00  2020-07-23 02:00:00  监测点A1  29.4979   \n",
       "3           3  2020-07-23 00:00:00  2020-07-23 03:00:00  监测点A1  29.2256   \n",
       "4           4  2020-07-23 00:00:00  2020-07-23 04:00:00  监测点A1  28.6577   \n",
       "\n",
       "   GROUND_T   PER_WET      WET     WIND  WIND_DIR  ...  SO2_  NO2_  PM10_  \\\n",
       "0   303.969  0.018661  66.4151  4.74343   168.368  ...  15.0  15.0   24.0   \n",
       "1   303.670  0.018639  66.8868  4.43134   168.069  ...   9.0  16.0   18.0   \n",
       "2   303.341  0.018906  68.5624  4.77030   167.315  ...   9.0  16.0   20.0   \n",
       "3   302.991  0.019813  73.0726  3.99873   182.342  ...   9.0  13.0   13.0   \n",
       "4   302.598  0.020176  77.1057  2.93413   197.937  ...  10.0  11.0   16.0   \n",
       "\n",
       "   PM2.5_   O3_   CO_    T_    WET_  WIND_  WIND_DIR_  \n",
       "0     8.0  33.0  0.55  28.3  71.956    2.3      178.0  \n",
       "1     5.0  27.0  0.50  28.0  73.352    1.6      182.0  \n",
       "2     7.0  27.0  0.50  28.0  73.548    1.7      172.0  \n",
       "3     5.0  29.0  0.50  27.8  75.101    1.3      159.0  \n",
       "4     3.0  29.0  0.45  27.1  78.152    2.1      170.0  \n",
       "\n",
       "[5 rows x 37 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv(targets[0], nrows=None)\n",
    "features = CONFIG().YB_FEATURES['A']\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(len(features)):\n",
    "    print(features[i])\n",
    "    plt.figure(figsize=(5,2))\n",
    "    plt.hist(df[features[i]], bins=150)\n",
    "    plt.title(features[i])\n",
    "    # fname = target_folder + self.match_type + '_dsitribution_' + self.station + '_' + fea.replace('/','每') + '.png'\n",
    "    # plt.savefig(fname)\n",
    "    plt.show()\n",
    "    plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
